home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
003
/
dba1186.arc
/
LA_PMT.PRG
< prev
next >
Wrap
Text File
|
1986-10-06
|
5KB
|
156 lines
* -- PROGRAM NAME: .......... LA_PMT.PRG
* -- PROGRAM TITLE: ......... Loan Amortization, Loan Repayment
* -- AUTHOR: ................ Venkat Penugonde
* Irvine Micro Arts, Irvine, CA
* -- SYSTEM ................. dBASE III & III +
* -- DATE FIRST CREATED .............. 08/02/86
* -- DATE MOST RECENTLY MODIFIED ..... 08/21/86
*
* This program calculates the equal periodic payment of a loan
* amortized over a given period and loan payment history.
*
* Inputs required ......... 1) Present Value or Principal.
* 2) Total Number of Payment Periods.
* 3) Annual Interest Rate.
* 4) Number of Payment Periods per Year.
*
* Outputs Generated ........ 1) Equal Periodic Payment.
* 2) Time History of Amounts Paid toward
* Principal, Interest and Balance.
*
* Calling Program .......... LOANAMRT.PRG
* Called Program ........... None
pok = 'N'
DO WHILE .t.
CLEAR
principal = 0.00
ann_rate = 0.000
t_period = 0
y_period = 0
@ 2, 27 SAY '* -- LOAN AMORTIZATION -- *'
@ 3, 27 SAY ' PERIODIC REPAYMENT'
@ 6, 11 SAY 'Enter Principal [0 to exit] ................ $'
@ 6, 58 GET principal PICTURE '99,999,999.99'
READ
IF principal <= 0
EXIT
ENDIF
@ 7, 11 SAY 'Enter Annual Interest Rate [%] .............. '
@ 7, 66 GET ann_rate PICTURE '99.999'
@ 8, 11 SAY 'Enter Number of Payment Periods ............. '
@ 8, 65 GET t_period PICTURE '999'
@ 9, 11 SAY 'Enter Number of Payment Periods/Year ........ '
@ 9, 66 GET y_period PICTURE '99'
READ
IF ann_rate <= 0 .OR. t_period <= 0 .OR. y_period <= 0
LOOP
ENDIF
pay_hist = 'Y'
@ 12, 11 SAY 'Show Payment History? [Y/N] ' ;
GET pay_hist PICTURE '!'
READ
IF pay_hist = 'Y'
pay_num = 1
balance = principal
t_int_paid = 0.00
t_pr_paid = 0.00
pay_numb = 1
pay_numt = t_period
*
@ 14, 11 SAY 'Enter beginning payment number .... '
@ 14, 47 GET pay_numb PICTURE '999' RANGE 1, t_period
@ 15, 11 SAY 'Enter number of payments desired .. '
@ 15, 47 GET pay_numt PICTURE '999' RANGE 1, t_period-pay_numb+1
READ
pay_numx = pay_numb + pay_numt - 1
ENDIF
* -- Caluculate interest rate per period
int_prd = ann_rate/(y_period*100)
*
* -- Calculate periodic payments
numerator = principal*int_prd
denomanator = (1 - (1 + int_prd)**(-t_period))
payment = numerator/denomanator
*
pok = 'Y'
@ 17, 11 SAY 'Output to Printer? [Y/N] ' GET pok PICTURE '!'
READ
IF pok = 'Y'
ready = ' '
@ 18, 11 SAY 'Turn printer on & hit any key to continue ';
GET ready
READ
SET PRINT ON
ENDIF
CLEAR
?
? SPACE(27) + '* -- LOAN AMORTIZATION -- *'
? SPACE(27) + ' PERIODIC REPAYMENT'
?
? SPACE(19) + 'PRINCIPAL = ';
+ STR(principal,13,2)
? SPACE(19) + 'ANNUAL INTEREST RATE [%] = ';
+ SPACE(8)+STR(ann_rate,6,3)
? SPACE(19) + 'NUMBER OF PERIODS = ';
+ SPACE(7)+STR(t_period,3)
? SPACE(19) + 'NUMBER OF PERIODS/YEAR = ';
+ SPACE(8)+STR(y_period,2)
?
? SPACE(19) + 'PAYMENT/PERIOD = ' + STR(payment,13,2)
IF pay_hist = 'Y'
* Calculate amounts toward principal and interest
* show principal paid, interest paid (current & total) and balance
?
?
? 'pmt# Principal Interest Principal;
Interest Balance'
? ' This Payment To Date;
Due'
? '--------------------------------------------------------;
---------------------'
?
DO WHILE pay_num <= pay_numx
int_paid = Balance*int_prd
pr_paid = payment - int_paid
balance = balance - pr_paid
IF BALANCE < 0
EXIT
ENDIF
t_int_paid = t_int_paid + int_paid
t_pr_paid = t_pr_paid + pr_paid
IF pay_num >= pay_numb
? STR(pay_num, 3)+' '+STR(pr_paid,13,2)+ ' ' ;
+STR(int_paid,13,2) +' ' + STR(t_pr_paid,13,2) ;
+' '+STR(t_int_paid,13,2) +' '+STR(balance,13,2)
ENDIF
pay_num = pay_num + 1
ENDDO WHILE pay_num <= pay_numx
ENDIF
?
ready = ' '
WAIT 'Press Space Bar To Continue ........... ' TO ready
IF pok = 'Y'
SET PRINT OFF
ENDIF
ENDDO WHILE .t.
IF pok = 'Y'
SET PRINT OFF
ENDIF
RETURN
*
* -- EOF LA_PMT --